//过滤需要显示的地址
export const filterAddress = (county: string | undefined, city: string | undefined, province: string | undefined) => {
  let str = ''
  if (county) {
    str = county
  } else if (city) {
    str = city
  } else if (province) {
    str = province
  }
  return str
}
//过滤需要显示的地址选项
export const filterAddressOption = (county: any, city: any, province: any) => {
  let obj: any = {}
  if (county.name) {
    if (county.name === '全部') {
      obj = city
    } else {
      obj = county
    }
  } else if (city.name) {
    if (city.name === '全部') {
      obj = province
    } else {
      obj = city
    }
  } else if (province.name) {
    obj = province
  }
  return obj
}
//过滤需要显示的完整地址
export const filterFullAddress = (addressArr: any[]) => {
  if (addressArr[0].name === addressArr[0].name) {
    addressArr.splice(1, 1)
  }
  return addressArr.map((item: any) => item.name).join('')
}

//过滤下拉选择项
export const filterOption = (list: any[], value: string | number) => {
  const obj: any = list.filter(item => {
    return item.value == value
  })
  return obj[0].text
}
